﻿using System;
using System.Linq;
using LINQPad.Extensibility.DataContext;
using Telerik.OpenAccess.Metadata;

namespace LINQPad.OpenAccess.Converters
{
    /// <summary>
    /// AssociationMultiplicity to <see cref="ExplorerIcon"/> converter.
    /// </summary>
    public partial class AssociationMultiplicityToExplorerIconConverter
    {
        /// <summary>
        /// Converts the association multiplicity to the corresponding icon.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="target">The target.</param>
        /// <param name="fallbackIcon">The fallback icon.</param>
        /// <returns>
        /// The icon or <paramref name="fallbackIcon" />.
        /// </returns>
        public virtual ExplorerIcon ToExplorerIcon( Multiplicity source, Multiplicity target, ExplorerIcon fallbackIcon = ExplorerIcon.Column )
        {
            return AssociationMultiplicityToExplorerIconConverter.GetExplorerIconForAssociation( source, target, fallbackIcon );
        }

    }
}
